﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace Xcj.Mes.WholeLine.ZH.HG.Shell.Converter
{
    public class DisableConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                int result = (value == null) ? 0 : int.Parse(value.ToString());

                if (result <= 0)
                    return "启用";
                else
                    return "禁用";
            }
            catch
            {
            }

            return "禁用";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
